home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / DTS Sample Code / System 7.0 Samples / CShell⁄THINK C / EventLoop.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-20  |  1.9 KB  |  80 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** MultiFinder-Aware CShell Application
  5. **
  6. ** Program:             CShell
  7. ** File:             eventloop.c
  8. ** Originally from:  Traffic Light 2.0 (2.0 version by Keith Rollin)
  9. ** Modified by:      Eric Soldan
  10. **
  11. ** Copyright © 1990-1991 Apple Computer, Inc.
  12. ** All rights reserved.
  13. */
  14.  
  15.  
  16.  
  17. /*****************************************************************************/
  18.  
  19.  
  20.  
  21. #include "CShell.h"                /* Get the CShell includes/typedefs, etc.    */
  22. #include "CShellCommon.h"        /* Get the stuff in common with rez.        */
  23. #include "CShell.protos"        /* Get the prototypes for CShell.            */
  24.  
  25. #ifndef __TEXTEDITCONTROL__
  26. #include "TextEditControl.h"
  27. #endif
  28.  
  29.  
  30.  
  31. /*****************************************************************************/
  32.  
  33.  
  34.  
  35. extern RgnHandle    gCurrentCursorRgn;        /* The current cursor region.
  36.                                             ** The initial cursor region is
  37.                                             ** an empty region, which will
  38.                                             ** cause WaitNextEvent to generate
  39.                                             ** a mouse-moved event, which will
  40.                                             ** cause us to set the cursor for
  41.                                             ** the first time.
  42.                                             */
  43. extern Boolean        gQuitApplication;        /* This is set to false by
  44.                                             ** Initialize.  When the user
  45.                                             ** selects Quit (and does not
  46.                                             ** abort the quit), then this
  47.                                             ** boolean is set true.
  48.                                             */
  49.  
  50.  
  51.  
  52. /*****************************************************************************/
  53. /*****************************************************************************/
  54.  
  55.  
  56.  
  57. /* Get events forever, and handle them by calling DoEvent.  Get the events by
  58. ** calling WaitNextEvent.  (This sample does a DeathAlert if WaitNextEvent
  59. ** isn't available.)
  60. */
  61.  
  62. #pragma segment Main
  63. void    EventLoop(void)
  64. {
  65.     EventRecord        event;
  66.  
  67.     while (!gQuitApplication) {
  68.  
  69.         if (WaitNextEvent(everyEvent, &event, 15, gCurrentCursorRgn))
  70.             DoEvent(&event);
  71.         else
  72.             DoIdleTasks();
  73.  
  74.         CTEIdle();
  75.     };
  76. }
  77.  
  78.  
  79.  
  80.